Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Update .env.example #32

Closed
wants to merge 2 commits into from
Closed

Update .env.example #32

wants to merge 2 commits into from

Conversation

laurencei
Copy link
Contributor

It is not obvious that you need to specifically set a different DB_TIMEZONE when using Lumen.

What I found is that if I had set the APP_TIMEZONE as this:

APP_TIMEZONE=Australia/Sydney

when I did this command in Lumen:

DB::table('pings')->insert([ 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);

then the timestamps were wrong unless I also set

DB_TIMEZONE=+10:00

Its the only way I could get it to work.

There are similar posts on Laracasts with people also talking about Lumen and DB timezone issues - like this: https://laracasts.com/discuss/channels/lumen/weird-timetimezone-behaviour?page=1

and this: laravel/lumen-framework#50 (at the end)

p.s. do we really need a different DB Timezone? Shouldnt it just use the App Timezone?

@GrahamCampbell
Copy link
Member

👎

@laurencei
Copy link
Contributor Author

@GrahamCampbell - why the downvote?

DB_TIMEZONE is clearly a setting in Lumen (for mySQL) that is not documented anywhere...

@GrahamCampbell
Copy link
Member

I don't think we should overload the .env file. People can add what they want in there when they want it.

@laurencei
Copy link
Contributor Author

But this is not documented anywhere. How will people know its actually an configurable option?

The Lumen config docs simply state to look at the .env file to see what is configurable... so...?

Maybe we have them as commented out options? Like most of the other items?

Anyway - I'll leave it for Taylor to decide either way...

@taylorotwell
Copy link
Member

I think it's common to store all DB stuff as UTC.

@Ugluth
Copy link

Ugluth commented Sep 21, 2015

I was also having some really weird issues when trying to select records from the database, the records that I expected were not returned, while the SQL was correct (e.g. fetched the expected results when run directly on the database). The APP_TIMEZONE did the trick, I set it to +02:00 and voila, expected results!

I agree that this should be mentioned somewhere in the documentation, if it wasn't for this issue I would still be looking! Thanks a lot.

@MartiniHenry1988
Copy link

I am facing an issue with Time zone in Lumen framework. I placed a varaible in .env file: APP_TIMEZONE=Europe/Paris. Its worked perfect for sometime. but now its returning timezone: Europe/London => Europe/London => GMT. Any idea what is the right way to set Timezone in Lumen?

@wojtekk
Copy link

wojtekk commented Nov 11, 2015

Work well for me - thanks.

Lumen should use APP_TIMEZONE I think.

If you want use named time zones like DB_TIMEZONE=Europe/Paris you have to import time zones to MySQL - on Ubuntu: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants